package com.argticling.model.chanel;

import java.util.ArrayList;
import java.util.List;

import com.argticling.model.Article;
import com.argticling.model.chanel.email.EmailManager;
import com.argticling.model.chanel.facebook.FacebookManager;
import com.argticling.model.chanel.feed.FeedManager;
import com.argticling.model.chanel.twitter.TwitterManager;

public class ChannelsManager {
    private List<WebChannelManager> channels;

    private List<WebChannelManager> loadChannels() {
        if (channels == null) {
            channels = new ArrayList<WebChannelManager>();
            channels.add(new EmailManager());
            channels.add(new FeedManager());
            channels.add(new TwitterManager());
//            channels.add(new FacebookManager());
        }
        return channels;
    }

    public void send(Article article) {
        List<WebChannelManager> channels = loadChannels();
        for (int j = 0; j < channels.size(); j++) {
            channels.get(j).send(article);
        }
    }
}
